home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 66
/
Vol 66.iso
/
games
/
bailer.swf
/
scripts
/
frame_14
/
DoAction.as
Wrap
Text File
|
2013-04-24
|
4KB
|
167 lines
chara_mc.state = 0;
chara_mc.fno = 0;
chara_mc.speed = chara_mc.ax = chara_mc.dir = 0;
chara_mc.prevDown = false;
chara_mc.ax = -20;
chara_mc.gotoAndStop(4);
suberu_sound.start(0);
chara_mc.isBusy = function()
{
return this.state != 0;
};
chara_mc.xSpin = function()
{
this.state = 3;
this.gotoAndStop(11 + this.dir * 11);
};
chara_mc.onEnterFrame = function()
{
var _loc2_ = this.dir;
var _loc3_ = this.ax;
if(gameState == 1 && isMouseDown && this.state != 2 || this._x < 0 || this._x > Stage.width)
{
if(csr_mc._currentframe == 1)
{
this.speed = -2;
this.dir = 0;
}
else
{
this.speed = 2;
this.dir = 1;
}
}
else if(gameState == 3 && this.state == 0 && (this._x < 290 || this._x > Stage.width - 290))
{
isMouseDown = true;
if(this._x < 290)
{
this.speed = 2;
this.dir = 1;
}
else
{
this.speed = -2;
this.dir = 0;
}
}
else
{
this.speed = 0;
}
if(this.speed == 0)
{
this.ax *= 0.9;
}
else
{
this.ax += this.speed;
}
this.ax = Math.max(Math.min(this.ax,MAX_SPEED),- MAX_SPEED);
this._x += this.ax;
var _loc4_ = (this._x - Stage.width / 2) * 100 / (Stage.width / 2);
suberu_sound.setPan(_loc4_);
if(this.state == 0 && (gameState == 1 || gameState == 3))
{
if(!this.prevDown && isMouseDown || (this.ax < 0 && _loc3_ >= 0 || this.ax >= 0 && _loc3_ < 0))
{
suberu_sound.stop();
suberu_sound.start(0);
this.gotoAndStop(2 + this.dir * 11);
}
else if(_loc2_ != this.dir)
{
this.gotoAndStop(4 + this.dir * 11);
}
if(!isMouseDown && Math.abs(this.ax) <= 1)
{
this.gotoAndStop(1 + this.dir * 11);
}
}
else if(this.state < 3)
{
if(_loc2_ != this.dir)
{
this.gotoAndStop(4 + getNo + this.dir * 11);
}
}
if(gameState == 3 && this.state == 0 && Math.abs(this.ax) < 1 && this.speed == 0)
{
this.xRemoveActionEvents();
this.gotoAndStop("doki");
}
this.prevDown = isMouseDown;
};
chara_mc.xActionEnd = function(fno)
{
if(this.state == 1 || this.state == 2)
{
this.prevDown = false;
this.state = 0;
this.gotoAndStop(this._currentframe + fno);
}
};
chara_mc.xIsHit = function(mc)
{
if(this.state != 0 || gameState != 1)
{
return false;
}
if(mc.no != 5)
{
var _loc3_ = [-10,10];
ox = 0;
oy = -20;
}
else
{
ox = 0;
oy = -40;
}
if(Math.abs(this._x + ox - mc._x) < 40 && Math.abs(this._y + oy - mc._y) < 40)
{
getNo = mc.no;
this.fno = 0;
this.state = getNo == 6 ? 2 : 1;
this.gotoAndStop(4 + getNo + this.dir * 11);
if(getNo != 6)
{
score += ITEM_SCORE[getNo - 1];
}
return true;
}
};
chara_mc.xRemoveActionEvents = function()
{
delete this.onEnterFrame;
};
csr_mc.onMouseDown = function()
{
isMouseDown = true;
};
csr_mc.onMouseUp = function()
{
isMouseDown = false;
};
csr_mc.onEnterFrame = function()
{
this.gotoAndStop(this._x <= chara_mc._x ? 1 : 2);
};
csr_mc.onMouseMove = function()
{
this._x = _root._xmouse;
this._y = _root._ymouse;
this.gotoAndStop(this._x <= chara_mc._x ? 1 : 2);
updateAfterEvent();
};
csr_mc.xRemoveActionEvents = function()
{
isMouseDown = false;
delete this.onEnterFrame;
delete this.onMouseMove;
delete this.onMouseDown;
delete this.onMouseUp;
};
Mouse.hide();
csr_mc.onMouseMove();